﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Rodunu.Utilities.General
{
    public class Converters
    {
        public static string ToBase64String(string text1, string text2)
        {
            try
            {
                byte[] stringAsBytes = Encoding.UTF8.GetBytes(string.Concat(text1, text2));

                return Convert.ToBase64String(stringAsBytes);
            }
            catch
            {
                return "==";
            }
        }

        public static byte[] ToByteArray(string text1)
        {
            try
            {
                return Encoding.UTF8.GetBytes(text1);
            }
            catch (Exception)
            {
                return null;
            }
        }
    }
}
